package com.cgw.dmplt.room.dao.ibatis;

import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import com.cgw.dmplt.room.domain.Building;
import com.cgw.dmplt.room.dao.BuildingDao;

/**
 *
 */
public class BuildingDaoImpl extends SqlMapClientDaoSupport implements BuildingDao
{

    
    /**
     * insert.
     * @param building building
     * @return id
     */
    public String insertBuilding(Building building)  {
    	getSqlMapClientTemplate().insert("Building_insertBuilding", building);
    	return "";
    }

    /**
     * delete.
     * @param building building
     */
    public void deleteBuilding(Building building) {
        getSqlMapClientTemplate().update("Building_deleteBuilding", building);
    }
    
    /**
     * update.
     * @param building building
     */
    public void updateBuilding(Building building)  {
    	getSqlMapClientTemplate().update("Building_updateBuilding", building);
    }
    
    /**
     * find.
     * @param id id
     * @return building
     * @ DataAccessException
     */
    public Building findBuilding(Integer pk)  {
        Building building = (Building) getSqlMapClientTemplate().queryForObject("Building_findBuilding", pk);
        return building;
    }
    
    /**
     * list.
     * @param building building
     * @return building list
     */
    public List listBuilding(Building building)  {
        List list = getSqlMapClientTemplate().queryForList("Building_listBuilding", building);
        return list;
    }  
    
    /**
     * listCount.
     * @param building building
     * @return list count
     */
    public Integer listBuildingCount(Building building)  {
        Integer count = (Integer)getSqlMapClientTemplate().queryForObject("Building_listBuildingCount", building);
        return count;
    }  
}
